<?php
$data = $this->data;

    /*
     * **************
     *  HEADER
     * **************
     */
    include 'views/inc/header.php'; ?>


    <link href="<?php echo $_layoutParams['root_css']; ?>colorbox.css" rel="stylesheet" />
    <link href="<?php echo $_layoutParams['root_css']; ?>jquery-ui-1.8.2.custom.css" rel="stylesheet" />
    </head>
    <!-- Body -->
    <body data-max="<?php echo MAX_LENGTH; ?>" data-accept="<?php echo $_SESSION['LANG']['accept']; ?>" data-cancel="<?php echo $_SESSION['LANG']['cancel']; ?>">
    <?php //include 'views/inc/profile_summary_inc.php'; ?>

    <!-- PopOut Message User -->
    <div id="container_popout_message"></div>
    <div class="popoutUser_message" id="content_popout_message">
        <div class="wrap_popout_message">
            <div class="title_popout_message">
                <span class="textPopout_message"></span>
                <div class="close_popout_message"></div>
            </div>
            <div class="content_user_message">
            </div><!-- content user -->
        </div><!-- wrap popout -->
    </div>
    <!-- Message user -->

    <!-- warpper_top_bar -->
    <div class="warpper_top_bar">
        <!-- inner_top_bar -->
        <header class="inner_top_bar">
            <!-- padding_class -->
            <div class="padding_class">
                <a href="<?php echo URL_BASE; ?>">
                    <?php include 'views/inc/logo.php'; ?>
                </a>

                <?php include 'views/inc/navigation.php'; ?>
            </div><!-- padding_class -->
        </header><!-- inner_top_bar -->
    </div><!-- warpper_top_bar -->

    <!-- page -->
    <div class="page">
    <!-- layout -->
    <section class="layout session">
    <div class="popout"></div>

    <div style="margin-top: 15px">
        <div class="wrapper_grid floatLeft banner_left">
            <?php include 'views/inc/advertising_left.php'; ?>


        </div><!-- wrapper_grid -->


        <!-- Grid 2 -->
        <div class="grid_2 floatLeft content_center">
            <!-- nav_profile -->
            <div class="grid_profile">
                <!-- container_profile -->

            </div><!-- nav_profile -->

            <h4 class="titleBar">Share On Your Wall</h4>

            <ul class="posts">
                <div id="container-loader">
                    <div class="share_on_wall">
                        <form action="http://<?=$_SERVER['HTTP_HOST']?>/public/ajax/ajaxShare.php" method="post" enctype="multipart/form-data"  id="ajax" >
                           <div class="fb_share">
                               <input class="btn_checkbox" type="checkbox" onclick="checkFBLogin();" name="fb_share"  id="checkbox" value="yes">
                               <span class="span_social">Facebook</span>
                               <input type="hidden" name="askId" value="<?=$this->data?>">
                           </div>
                           <div class="tw_share">
                               <input id="tw_share" class="btn_checkbox " type="checkbox" name="tw_share" value="yes" data-title="<?= $this->title?>" data-rel="https://twitter.com/home?status=http://<?=$_SERVER['HTTP_HOST'].'/ask/'.$this->data ?>">
                               <span class="span_social">Twitter </span>

                           </div>
                            <div style="">
                                <button type="submit" id="submit" style="" class="btn-slider-vote custom-btn" >Publish</button>
                            </div>
                        </form>

                    </div>
<!--                    <div class="loading-bar"></div>-->
                </div>
            </ul><!-- UL POST -->

        </div><!-- Grid 2 -->

        <!-- wrapper_grid -->
        <div class="wrapper_grid floatRight  banner_right">

            <?php
            //<---- * advertising * --->
            //      include 'views/inc/advertising_right.php';
            //<---- * who_follow * --->
            //  include 'views/inc/who_to_follow.php';
            //<---- * trending * --->
            include('views/inc/advertising_right.php');
            ?>

        </div><!-- wrapper_grid -->

    </div><!-- padding_class -->
    </div>
    </section><!-- layout -->
    <!-- Grid 1 -->
    <div style="clear: both"></div>
    <div class="grid_1 footer_new" style="width: 100%;float: left">
        <!-- container_grid -->
        <div class="container_grid about_pages">
            <?php include 'views/inc/footer_session.php'; ?>
        </div><!-- container_grid -->
    </div><!-- Grid 1 -->

    </div><!-- page -->

    <div class="modal">
        <div id="content_modal">
        </div>
    </div>


    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
    <script src="<?php echo $_layoutParams['root_js']; ?>jquery.easing.1.3.js"></script>
    <script src="<?php echo $_layoutParams['root_js']; ?>jquery.placeholder.1.1.1.min.js"></script>
    <script src="<?php echo $_layoutParams['root_js']; ?>jquery-ui-1.8.17.custom.min.js"></script>
    <script src="<?php echo $_layoutParams['root_js']; ?>functions.js"></script>
    <script src="<?php echo $_layoutParams['root_js']; ?>count.js"></script>
    <script src="<?php echo $_layoutParams['root_js']; ?>add.post.js"></script>
    <script src="<?php echo $_layoutParams['root_js']; ?>jquery.form.js"></script>
    <script src="<?php echo $_layoutParams['root_js']; ?>timeago/jqueryTimeago_<?php echo $_SESSION['lang']; ?>.js"></script>
    <script src="<?php echo $_layoutParams['root_js']; ?>jquery.colorbox.js"></script>
    <script src="<?php echo $_layoutParams['root_js']; ?>jquery.scroll.user.js"></script>

    <?php if( !Session::get( 'authenticated' ) ) : ?>
        <script src="<?php echo $_layoutParams['root_js']; ?>login.sign.up.js"></script>
    <?php endif; ?>

    <?php if( Session::get( 'authenticated' )
        && $_GET['action'] == ''
        || Session::get( 'authenticated' )
        && $_SESSION['authenticated'] != $this->info->id  ) : ?>
    <?php endif; ?>

    <script type="text/javascript">

        jQuery(document).ready(function($) {
             $(document).on('click','#tw_share',function(){
               var url = $(this).attr('data-rel');
               var rel = $(this).attr('data-rel');
                  window.location.replace(rel);
             })
            $("#ajax").submit(function(){
                $("#submit").text("Loading....");
                $.ajax({
                    url:$(this).attr("action"),
                    type: "POST",
                    data:$(this).serialize() ,
                    success: function(data){
                        var response = JSON.parse(data);
                        if(response.status == true){
                            window.location.replace('http://'+window.location.host);
                        }else{
                            console.log(response);
                           // alert(response.message);
                        }

                        return false;
                    } ,
                    error:function(error){
                        alert(error);
                        return false
                    }
                });
                return false;
            });
            $('#top').live('click',function()
            {
                $('body,html').animate({ scrollTop: 0
                }, 800);
            });

            //=== PLACEHOLDER
            $(function(){
                $(':input[placeholder]').placeholder();
            });
            //====== TIME AGO

            <?php if( Session::get( 'authenticated' ) ) : ?>


            $('#reply_post').live('hover', function(){
                if ($(this).data('hascharcount') == undefined) {
                    $(this).data('hascharcount', true).charCount({ allowed: <?php echo MAX_LENGTH; ?>, warning: 10 });
                }
            });

            $('#message').live('hover', function(){
                if ($(this).data('hascharcount') == undefined) {
                    $(this).data('hascharcount', true).charCount({ allowed: <?php echo MAX_LENGTH; ?>, warning: 10 });
                }
            });

            //================  * COUNTER * =============//
            $('#add_post').live('hover', function(){
                if ($(this).data('hascharcount') == undefined ) {
                    $(this).data('hascharcount', true).charCount({ allowed: <?php echo MAX_LENGTH; ?>, warning: 10, css: 'counter_2' });
                }
            });


            //=================== * UPLOAD  * ===============//
            $('#upload').live('change', function(){
                $('<div id="loader_gif"></div>').insertBefore('#upload');
                $('#button_add').attr({'disabled' : 'true'}).css({'opacity':'0.5','cursor':'default'});
                $('#add_post').attr({'disabled' : 'true'}).css({'opacity':'0.5'});


                (function() {

                    $("#form_add_post").ajaxForm({

                        dataType : 'json',
                        success:  function(e) {
                            if( e ) {

                                $('#add_post').removeAttr('disabled').css({'opacity':'1'});
                                if( e.error == 1 ) {
                                    $('#loader_gif').remove();
                                }

                                $('#wrapper_preview').show();
                                $('#container_preview').html( ''+ e.output +'' ).show();
                                $('#upload').val('');

                                if( e.error == 0 ) {
                                    $('#loader_gif').css({background:'url("<?php echo URL_BASE; ?>thumb/60-60-tmp/'+ e.photo +'") center center no-repeat #FFF'}).addClass('deletePhoto').attr( 'data',e.photo ).attr( 'title','<?php echo $_SESSION['LANG']['delete_image']; ?>' );
                                    $('#wrapper_preview').show();
                                    $('#photoId').val(e.photo);
                                    $('#button_add').removeAttr('disabled').css({'opacity':'1','cursor':'pointer'});
                                }

                            }
                            else {
                                jAlert('<?php echo $_SESSION['LANG']['error']; ?>');
                                $('#upload').val('');
                                $('#button_add').removeAttr('disabled').css({'opacity':'1','cursor':'pointer'});
                                $('#add_post').removeAttr('disabled').css({'opacity':'1'});
                                $('#loader_gif').remove();


                            }
                        }//<----- SUCCESS

                    }).submit();
                })(); //<--- FUNCTION %
            });//<--- LIVE

            //===== DELETE PHOTO
            $(".deletePhoto").live('click',function(){
                //=== PARAM
                var element     = $(this);
                var id          = element.attr("data");
                var info        = 'token_id=' + id;
                var add_post_   = $('#add_post').val();
                var video_link_ = $('#video_link').val();
                var song_link_ = $('#song_link').val();

                $.ajax({
                    type: "GET",
                    url: "<?php echo URL_BASE; ?>public/ajax/delete_id_photo.php",
                    data: info,
                    success: function(output){
                        if( output == 'TRUE' ) {
                            if( add_post_ == 0 && video_link_ == 0 && song_link_ == 0 ) {
                                $('#button_add').attr({'disabled' : 'true'}).css({'opacity':'0.5','cursor':'default'});
                            }

                            $('#photoId').val('');
                            element.fadeOut('fast',function(){
                                element.remove();
                            });//<-- FUNCTION
                        }

                    }

                });//<-- AJAX
            });//<--- CLICK

            <?php endif; ?>


        });//<-------- * DOM * ------>

    </script>
    <script>


    </script>


    </body>
    </html>

